package com.gjun.struts.action;

import java.util.Date;

import com.gjun.struts.bean.ext.Order;
import com.gjun.struts.resource.dao.IOrderDao;


public class SaveOrdersAction {
	private int id;
	private int userId;
	private int status;
	private Date orderTime;
	private String orderDesc;
	private double totalPrice;
	private String receiveName;
	private String fullAddress;
	private String postalCode;
	private String mobile;
	private String phone;
	private String isSend;
	private String isReceive;
	
	private String result ;
	
	private IOrderDao orderDao;
	
	/**
	 * @return the isSend
	 */
	public String getIsSend() {
		return isSend;
	}
	/**
	 * @param isSend the isSend to set
	 */
	public void setIsSend(String isSend) {
		this.isSend = isSend;
	}
	/**
	 * @return the isReceive
	 */
	public String getIsReceive() {
		return isReceive;
	}
	/**
	 * @param isReceive the isReceive to set
	 */
	public void setIsReceive(String isReceive) {
		this.isReceive = isReceive;
	}
	/**
	 * @return the id
	 */
	public int getId() {
		return id;
	}
	/**
	 * @param id the id to set
	 */
	public void setId(int id) {
		this.id = id;
	}
	/**
	 * @return the userId
	 */
	public int getUserId() {
		return userId;
	}
	/**
	 * @param userId the userId to set
	 */
	public void setUserId(int userId) {
		this.userId = userId;
	}
	/**
	 * @return the status
	 */
	public int getStatus() {
		return status;
	}
	/**
	 * @param status the status to set
	 */
	public void setStatus(int status) {
		this.status = status;
	}
	/**
	 * @return the orderTime
	 */
	public Date getOrderTime() {
		return orderTime;
	}
	/**
	 * @param orderTime the orderTime to set
	 */
	public void setOrderTime(Date orderTime) {
		this.orderTime = orderTime;
	}
	/**
	 * @return the orderDesc
	 */
	public String getOrderDesc() {
		return orderDesc;
	}
	/**
	 * @param orderDesc the orderDesc to set
	 */
	public void setOrderDesc(String orderDesc) {
		this.orderDesc = orderDesc;
	}
	/**
	 * @return the totalPrice
	 */
	public double getTotalPrice() {
		return totalPrice;
	}
	/**
	 * @param totalPrice the totalPrice to set
	 */
	public void setTotalPrice(double totalPrice) {
		this.totalPrice = totalPrice;
	}
	/**
	 * @return the receiveName
	 */
	public String getReceiveName() {
		return receiveName;
	}
	/**
	 * @param receiveName the receiveName to set
	 */
	public void setReceiveName(String receiveName) {
		this.receiveName = receiveName;
	}
	/**
	 * @return the fullAddress
	 */
	public String getFullAddress() {
		return fullAddress;
	}
	/**
	 * @param fullAddress the fullAddress to set
	 */
	public void setFullAddress(String fullAddress) {
		this.fullAddress = fullAddress;
	}
	/**
	 * @return the postalCode
	 */
	public String getPostalCode() {
		return postalCode;
	}
	/**
	 * @param postalCode the postalCode to set
	 */
	public void setPostalCode(String postalCode) {
		this.postalCode = postalCode;
	}
	/**
	 * @return the mobile
	 */
	public String getMobile() {
		return mobile;
	}
	/**
	 * @param mobile the mobile to set
	 */
	public void setMobile(String mobile) {
		this.mobile = mobile;
	}
	/**
	 * @return the phone
	 */
	public String getPhone() {
		return phone;
	}
	/**
	 * @param phone the phone to set
	 */
	public void setPhone(String phone) {
		this.phone = phone;
	}
	/**
	 * @return the result
	 */
	public String getResult() {
		return result;
	}
	/**
	 * @param result the result to set
	 */
	public void setResult(String result) {
		this.result = result;
	}
	/**
	 * @return the orderDao
	 */
	public IOrderDao getOrderDao() {
		return orderDao;
	}
	/**
	 * @param orderDao the orderDao to set
	 */
	public void setOrderDao(IOrderDao orderDao) {
		this.orderDao = orderDao;
	}
	
	
	public String updateOrder(){
		Order order = orderDao.getOrderById(id);
		//order.setOrderTime(orderTime.getTime());
		//order.setOrderDesc(orderDesc);
		order.setIsSend(isSend);
		order.setIsReceive(isReceive);
		order.setReceiveName(receiveName);
		order.setFullAddress(fullAddress);
		order.setPostalCode(postalCode);
		order.setMobile(mobile);
		order.setPhone(phone);
		orderDao.updateOrder(order);
		result = "updateSuccess";
		return "success";
	}

}
